# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=depdep
pkgver=2.0
pkgrel=4
groups=('blackarch' 'blackarch-networking' 'blackarch-malware')
pkgdesc='A merciless sentinel which will seek sensitive files containing critical info leaking through your network.'
arch=('any')
url='https://github.com/galkan/depdep'
license=('custom:unknown')
depends=('python2' 'smbclient' 'cifs-utils' 'java-environment' 'apache-tika')
source=("https://github.com/galkan/depdep/archive/$pkgver.tar.gz"
        'https://raw.githubusercontent.com/galkan/depdep/master/LICENSE.txt')
sha512sums=('b7741b32af28708fc7547240449748729a491284d4559048104c5f37ea7102c6209730bdb5863643d518be8d1340617c63901f340b9e483518b6d3d065f4f01f'
            '38f659b5c3eea636e8ed819fa9ebf10b5590c469ca5ab8bf0a3462d57d438fa2f65647a70f21b6b00531f82f82d228d50271d23325d780dd3a525edeaf5b39d3')
prepare(){
  cd "$pkgname-$pkgver"

  sed -i 's|python$|env python2|' *.py
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/bin"

  for i in config lib script ; do
    install -dm 755 "$pkgdir/usr/share/$pkgname/$i"
    cp -a --no-preserve=ownership $i/* "$pkgdir/usr/share/$pkgname/$i/"
  done

  install -Dm 755 "$pkgname.py" "$pkgdir/usr/share/$pkgname/$pkgname.py"
  install -Dm 644 $srcdir/LICENSE.txt \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

